//
//  RmdComplexCell.m
//  Travel assistant
//
//  Created by 杨帆 on 16/3/10.
//  Copyright © 2016年 旅游助手. All rights reserved.
//

#import "RmdComplexCell.h"

#define KScreenWidth [[UIScreen mainScreen] bounds].size.width
#define KScreenHeight [[UIScreen mainScreen] bounds].size.height

@implementation RmdComplexCell


-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    
    if (self) {
        
        [self addViews];
        
    }
    
    return self;
    
}


-(void)addViews{
    
    
    
    self.mainImageV.frame = CGRectMake(0.031*KScreenWidth, 0.018*KScreenHeight, 0.937*KScreenWidth, 0.317*KScreenHeight);
    
//    self.mainImageV.backgroundColor = [UIColor orangeColor];
    self.mainImageV.layer.cornerRadius = 10;
    
    self.mainImageV.layer.masksToBounds = YES;
    
    [self.contentView addSubview:self.mainImageV];
    
    
    
    self.titleLabel.frame = CGRectMake(0.047*KScreenWidth, 0.026*KScreenHeight, 0.9*KScreenWidth, 0.044*KScreenHeight);
    
//    self.titleLabel.backgroundColor = [UIColor redColor];
    
    self.titleLabel.numberOfLines = 0;
    
    self.titleLabel.font = [UIFont fontWithName:@"Helvetica-Bold" size:20];
    
    self.titleLabel.textColor = [UIColor whiteColor];
    
    [self.contentView addSubview:self.titleLabel];
    
    
    
    
    
    self.smallBlueImageV.frame = CGRectMake(0.047*KScreenWidth, 0.088*KScreenHeight, 0.012*KScreenWidth, 0.039*KScreenHeight);
    self.smallBlueImageV.backgroundColor = [UIColor colorWithRed:0.5 green:1 blue:1 alpha:1];
    
    [self.contentView addSubview:self.smallBlueImageV];
    
    self.dateLabel.frame = CGRectMake(0.08*KScreenWidth, 0.088*KScreenHeight, 0.156*KScreenWidth, 0.018*KScreenHeight);
    
//    self.dateLabel.backgroundColor = [UIColor greenColor];
    
    self.dateLabel.font = [UIFont fontWithName:@"Helvetica-Bold" size:10];
    
    self.dateLabel.textColor = [UIColor whiteColor];
    [self.contentView addSubview:self.dateLabel];
    
    
    self.dayLabel.frame = CGRectMake(0.256*KScreenWidth, 0.088*KScreenHeight, 0.08*KScreenWidth, 0.018*KScreenHeight);
    
//    self.dayLabel.backgroundColor = [UIColor grayColor];
    
    self.dayLabel.font = [UIFont fontWithName:@"Helvetica-Bold" size:10];
    self.dayLabel.textColor = [UIColor whiteColor];
    [self.contentView addSubview:self.dayLabel];
    
    self.countLabel.frame = CGRectMake(0.35*KScreenWidth, 0.088*KScreenHeight, 0.156*KScreenWidth, 0.018*KScreenHeight);
    
//    self.countLabel.backgroundColor = [UIColor brownColor];
    
    self.countLabel.font = [UIFont fontWithName:@"Helvetica-Bold" size:10];
    
    self.countLabel.textColor = [UIColor whiteColor];
    [self.contentView addSubview:self.countLabel];
    
    
    self.placeLabel.frame = CGRectMake(0.08*KScreenWidth, 0.114*KScreenHeight, 0.5*KScreenWidth, 0.018*KScreenHeight);
    
//    self.placeLabel.backgroundColor = [UIColor greenColor];
    
    self.placeLabel.font = [UIFont systemFontOfSize:10];
    
    self.placeLabel.textColor = [UIColor whiteColor];
    [self.contentView addSubview:self.placeLabel];
    
    
    self.userImageV.frame = CGRectMake(0.04*KScreenWidth, 0.264*KScreenHeight, 0.062*KScreenWidth, 0.035*KScreenHeight);
    
//    self.userImageV.backgroundColor = [UIColor blueColor];
    
    self.userImageV.layer.cornerRadius = self.userImageV.bounds.size.width/2;
    
    self.userImageV.layer.masksToBounds = YES;
    
    self.userNameLabel.textColor = [UIColor whiteColor];
    
    [self.contentView addSubview:self.userImageV];
    
    self.userNameLabel.frame = CGRectMake(0.12*KScreenWidth, 0.27*KScreenHeight, 0.3*KScreenWidth, 0.021*KScreenHeight);
    
    self.userNameLabel.font = [UIFont systemFontOfSize:14];
    
//    self.userNameLabel.backgroundColor = [UIColor redColor];
    
    
    [self.contentView addSubview:self.userNameLabel];
    
    
    
    
}


-(UILabel *)titleLabel{
    
    if (!_titleLabel) {
        _titleLabel = [UILabel new];
    }
    
    return _titleLabel;
}


-(UIImageView *)mainImageV{
    
    if (!_mainImageV) {
        _mainImageV = [UIImageView new];
    }
    
    return _mainImageV;
    
}

-(UIImageView *)smallBlueImageV{
    
    if (!_smallBlueImageV) {
        _smallBlueImageV = [UIImageView new];
    }
    
    return _smallBlueImageV;
    
    
}

-(UILabel *)dateLabel{
    if (!_dateLabel) {
        _dateLabel = [UILabel new];
    }
    return _dateLabel;
    
}

-(UILabel *)dayLabel{
    
    
    if (!_dayLabel) {
        _dayLabel = [UILabel new];
    }
    return _dayLabel;
}

-(UILabel *)countLabel{
    
    if (!_countLabel) {
        _countLabel = [UILabel new];
    }
    
    return _countLabel;
}

-(UILabel *)placeLabel{
    
    if (!_placeLabel) {
        _placeLabel = [UILabel new];
    }
    
    return _placeLabel;
}

-(UIImageView *)userImageV{
    
    if (!_userImageV) {
        _userImageV = [UIImageView new];
    }
    return _userImageV;
}

-(UILabel *)userNameLabel{
    
    if (!_userNameLabel) {
        _userNameLabel = [UILabel new];
    }
    return _userNameLabel;
}

-(void)layoutSubviews{
    
    
    [super layoutSubviews];
    
    self.titleLabel.frame = CGRectMake(0.047*KScreenWidth, 0.026*KScreenHeight, 0.9*KScreenWidth, 0.044*KScreenHeight);
    
    self.mainImageV.frame = CGRectMake(0.031*KScreenWidth, 0.018*KScreenHeight, 0.937*KScreenWidth, 0.317*KScreenHeight);
    
    self.smallBlueImageV.frame = CGRectMake(0.047*KScreenWidth, 0.088*KScreenHeight, 0.012*KScreenWidth, 0.039*KScreenHeight);
    
    self.dateLabel.frame = CGRectMake(0.08*KScreenWidth, 0.088*KScreenHeight, 0.156*KScreenWidth, 0.018*KScreenHeight);
    
    self.dayLabel.frame = CGRectMake(0.256*KScreenWidth, 0.088*KScreenHeight, 0.08*KScreenWidth, 0.018*KScreenHeight);
    
    self.countLabel.frame = CGRectMake(0.35*KScreenWidth, 0.088*KScreenHeight, 0.156*KScreenWidth, 0.018*KScreenHeight);
    
    
    self.placeLabel.frame = CGRectMake(0.08*KScreenWidth, 0.114*KScreenHeight, 0.5*KScreenWidth, 0.018*KScreenHeight);
    
    
    self.userImageV.frame = CGRectMake(0.04*KScreenWidth, 0.264*KScreenHeight, 0.062*KScreenWidth, 0.035*KScreenHeight);
    
    
    self.userNameLabel.frame = CGRectMake(0.12*KScreenWidth, 0.27*KScreenHeight, 0.3*KScreenWidth, 0.021*KScreenHeight);
    
}

























- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
